package com.xy.biz.mes.domain.converter;

import com.xy.biz.mes.domain.po.ManufactureOrderGoodsPO;
import com.xy.biz.mes.domain.bo.ManufactureOrderGoodsBO;
import com.xy.biz.mes.domain.req.SaveManufactureOrderGoodsRequest;
import com.xy.biz.mes.domain.resp.GetManufactureOrderGoodsResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 *
 *
 * @author zsp
 * @date 2022-1-19
 */
public class ManufactureOrderGoodsConverter {

	public static ManufactureOrderGoodsPO toPO(ManufactureOrderGoodsBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureOrderGoodsPO(), true);
	}

	public static List<ManufactureOrderGoodsPO> toPO(Collection<ManufactureOrderGoodsBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureOrderGoodsPO(), true);
	}

	public static ManufactureOrderGoodsBO fromPO(ManufactureOrderGoodsPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureOrderGoodsBO());
	}

	public static List<ManufactureOrderGoodsBO> fromPO(Collection<ManufactureOrderGoodsPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureOrderGoodsBO());
	}

	public static ManufactureOrderGoodsBO toBO(SaveManufactureOrderGoodsRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new ManufactureOrderGoodsBO(), true);
	}

	public static List<ManufactureOrderGoodsBO> toBO(Collection<SaveManufactureOrderGoodsRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new ManufactureOrderGoodsBO(), true);
	}

	public static GetManufactureOrderGoodsResponse toResponse(ManufactureOrderGoodsBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetManufactureOrderGoodsResponse());
	}

	public static List<GetManufactureOrderGoodsResponse> toResponse(Collection<ManufactureOrderGoodsBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetManufactureOrderGoodsResponse());
	}

}
